﻿package org.atk
{
	import flash.display.Sprite;
	import flash.display.*;
	import flash.geom.Transform;
	import flash.geom.Matrix;
	import flash.system.*;
	import org.aswing.AsWingManager;
	import org.aswing.UIManager;
	import org.aswing.skinbuilder.orange.OrangeLookAndFeel;  
	import org.flashdevelop.utils.FlashConnect;
	import flash.events.Event;

	
	/**
	 * ...
	 * @author AeTky
	 */
	public class Main extends Sprite 
	{
		private var app:Application;
		public function Main():void {
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void {
			removeEventListener(Event.ADDED_TO_STAGE, init);
			AsWingManager.initAsStandard(this);
			AsWingManager.setRoot(this);			
			var oLaF:OrangeLookAndFeel = new OrangeLookAndFeel();
			UIManager.setLookAndFeel(oLaF);
			
			var s:int = 1000;			
			UIManager.getDefaults().put("Accordion.motionSpeed", s);
			//FlashConnect.trace(UIManager.getInt("Accordion.motionSpeed").toString());
			
			app = new Application();
			stage.addEventListener(Event.RESIZE, resizeHandler);
			stage.dispatchEvent(new Event(Event.RESIZE));

			
		}
		public function resizeHandler(e:Event):void {
			app.evtResize(stage.stageWidth,stage.stageHeight);
			/*
				app.setWidth(stage.stageWidth);
				app.setHeight(stage.stageHeight);
			*/
			//FlashConnect.trace("w: "+stage.stageWidth+" h: "+stage.stageHeight);
		}
		
	}
	
}